package com.greentravel.model;

import java.util.Date;

/**
 * 评论实体类
 * 存储用户对动态的评论信息
 */
public class Comment {
    private int id; // 评论ID
    private int momentId; // 动态ID
    private int userId; // 评论用户ID
    private String content; // 评论内容
    private Date commentTime; // 评论时间

    // 默认构造方法
    public Comment() {
    }

    // 带参数的构造方法
    public Comment(int id, int momentId, int userId, String content, Date commentTime) {
        this.id = id;
        this.momentId = momentId;
        this.userId = userId;
        this.content = content;
        this.commentTime = commentTime;
    }

    // 新增评论用的构造方法
    public Comment(int momentId, int userId, String content) {
        this.momentId = momentId;
        this.userId = userId;
        this.content = content;
        this.commentTime = new Date();
    }

    // getter和setter方法
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getMomentId() {
        return momentId;
    }

    public void setMomentId(int momentId) {
        this.momentId = momentId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCommentTime() {
        return commentTime;
    }

    public void setCommentTime(Date commentTime) {
        this.commentTime = commentTime;
    }

    @Override
    public String toString() {
        return "Comment{" +
                "id=" + id +
                ", momentId=" + momentId +
                ", userId=" + userId +
                ", content='" + content + '\'' +
                ", commentTime=" + commentTime +
                '}';
    }
}